/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.latticeware.xtalk.editor;


import java.awt.*;
import java.awt.event.ActionListener;



/**
 *
 * @author sfisque
 */
public class ScriptEditor
extends Frame
{
    TextArea scriptArea;
    
    
    public ScriptEditor()
    {
        super( "Script Editor" );
        
        setLayout( new GridLayout( 1, 1 ) );
        
        scriptArea = new TextArea();
        add( scriptArea );
        
        MenuBar mbar = new MenuBar();
        Menu _fileMenu = new Menu( "File" );
        _fileMenu.add( "Save" );
        _fileMenu.add( "Close" );
        mbar.add( _fileMenu );
        Menu _editMenu = new Menu( "Edit" );
        _editMenu.add( "Cut" );
        _editMenu.add( "Copy" );
        _editMenu.add( "Paste" );
        _editMenu.add( "Clear" );
        mbar.add( _editMenu );
        setMenuBar( mbar );
        
        setSize( 378, 378 );
        setLocation( 512, 20 );
    }
    
    
    public void setScript( String s )
    {
        scriptArea.setText( s );
    }
    
    
    public String getScript()
    {
        return scriptArea.getText();
    }


    public void setSaveListener( ActionListener al )
    {
        getMenuBar().getMenu( 0 ).addActionListener( al );
    }
}
